Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop linking with Boost::regex. #219

Conversation

Romain-Geissler-1A
Copy link

Normally Boost regex is header only when using C++ >= 11, and C++11 become mandatory in Boost::log recently.

Normally Boost regex is header only when using C++ >= 11, and C++11
become mandatory in Boost::log recently.
@Romain-Geissler-1A
Copy link
Author

Note: for now I didn't test this locally yet, I need to integrate this in my own build of Boost (we use internally boost 1.83, where C++11 was not mandatory yet). The main reason for opening the pull request at this point is to run your CI to see how things are broken with these changes (hopefully it's not, but I prefer having a CI double check !)

@Lastique
Copy link
Member

I don't think Boost.Regex requires the same level of C++11 for its header-only version as Boost.Log does. In particular, I see it requires BOOST_NO_CXX11_HDR_TYPE_TRAITS, which is only supported since gcc 5, and Boost.Log currently supports versions older than that.

@Lastique
Copy link
Member

Lastique commented Sep 25, 2023

I think, I could merge a change to stop linking with Boost.Regex, but only if it is confirmed by a configure check. That is, the configure time test program should verify if Boost.Regex is header-only for the current build. But I don't think I'll merge the unconditional drop of linking.

@Romain-Geissler-1A
Copy link
Author

Mmmh at this point I have no idea how to write a configure check (practically speaking, I don't know anything about the boost build system right now, but I can learn). But even if I knew this, honestly, I don't really know how I would check if boost regex is header only or not for the current toolset. If you build a basic .cpp file trying to use boost log headers, but not boost log lib, and try to link this, in the end you only checked that this very specific .cpp file doesn't need the log library, but technically other C++ code might need it. So in the end, it would only be an allow list (if the toolset is gcc, then if it's >= X.Y.Z it's header only, otherwise not, if the toolset is clang then...). And I am not sure this is something you want to maintain (if I were a maintainer, I wouldn't like this much to be honest).

So, what's your opinion here ?

@Romain-Geissler-1A
Copy link
Author

I am just thinking about something else.

Is there a way to detect the C++ dialect used to build boost itself, at build time ? If yes, would you be ok to define some threshold, like: "if boost itself is built with C++ >= 14 or 17, then I assume the underlying compiler is recent enough and we consider Log is header only, otherwise no" ?

Lastique added a commit that referenced this pull request Sep 25, 2023
Boost.Log supports compilers that do not qualify as C++11 compilers
for Boost.Regex, even if they are compiling in C++11 mode. In that
case, we still need to link with Boost.Regex v4 prebuilt library.

For more recent compilers, Boost.Regex v5 is used, and that is
a header-only library. This commit removes linking with Boost.Regex
when this is detected at configure time.

Note that only Boost.Build is updated. CMake doesn't need to be
updated since even header-only libraries need to be listed as
dependencies.

Closes #219.
@Lastique Lastique closed this in 4db6450 Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants